﻿@using CoralNode.Core.Entity.Enums
@using CoralNode.MvcClient.Helper
@using Coralcode.Utils.Basic
@model CoralNode.Core.Entity.Domains.User.UserDomain

@{
    ViewBag.Title = "ChangePwd";
}
@Html.IncludePage("CoralAdmin/user", "_Left")
<div id="pbody">
    <div class="extra">
        <div class="pbody_top">
            <span class="ico ico_setting_system"></span><span class="t t_c">用户管理&nbsp;&nbsp;/&nbsp;&nbsp;<b
                class=" t_small f_no">修改密码</b></span>
        </div>
        <div id="main">
            <div class="local">
                <a href="/m/user/listRole" class="ico ico_back btn"></a>
            </div>
            <div class="content_tab extra_normal">
                <div class="tablist extra_normal" data-js="tab">
                    <a href="#">主要信息</a>
                </div>
            </div>
            <form id="spform" action="/m/user/changeuserpwd" method="post" enctype="multipart/form-data">
                @if (@ViewBag.Msg != null) {
                    <div class="error_msg">
                        @ViewBag.Msg.Msg
                    </div>
                }
                <div class="pt_3 js_tabcnt">
                    <div class="table_form form_main ">
                        <div class="pl_2 pb_3">
                            @Html.AntiForgeryToken()
                            @Html.ValidationSummary(true)
                            <table>
                                <tbody>
                                    <tr>
                                        <th width="80">名称<span class="rq">*</span></th>
                                        <td>
                                            @(string.IsNullOrEmpty(Model.Name) ? Model.Account : Model.Name)
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>旧密码<span class="rq">*</span></th>
                                        <td>@Html.Password("passwordModel.OldPassword", string.Empty, new { @class = "text w_37" })
                                            <div class="exp ml_1">4-16个字符，支持英文小写、数字、下划线</div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>新密码<span class="rq">*</span></th>
                                        <td>@Html.Password("passwordModel.Password", string.Empty, new { @class = "text w_37" })
                                            <div class="exp ml_1">4-16个字符，支持英文小写、数字、下划线</div>
                                        </td>
                                    </tr>
                                      <tr>
                                        <th>确认密码<span class="rq">*</span></th>
                                        <td>@Html.Password("passwordModel.ConPassword", string.Empty, new { @class = "text w_37" })
                                            <div class="exp ml_1">4-16个字符，支持英文小写、数字、下划线</div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="submitbox p_2 extra_normal">
                    @Html.Hidden("Id", Model.Id)
                    <input type="submit" class="btn_1" value="提    交" />
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    $(function () {
        $("form").submit(function (e) {
            e.preventDefault();
            var $this = $(this);
            if ($this.valid()) {
                $.post($this.attr("action"), $this.serialize(), function (data) {
                    if (data.Type == 5) {
                        $.alert(data.Msg)
                        setTimeout('location.href = "/m/user/listuser"', 2000);
                    }
                    else {
                        $.alert(data.Msg, "error");
                    }
                });
            }
        })

        $('.nav_left_style2').find('li').eq(0).addClass('current');
    })
</script>
